package com.rd.student.jiaji.class4.suyan.zrrd.Read;

public class Exercise3 {
    public static void main(String[] args) {
        String s1 = "aaaaaaabbbbbcerrrrggggggggsssssspoqqqqq";
        handleString1(s1);
    }
    public static void handleString1(String s1) {
        String s2 =""+s1.charAt(0);
        int count=1;
        for (int i=1;i<s1.length();i++){
            if (s1.charAt(i)==s1.charAt(i-1)){
                count++;
            }else if (count!=1){
                s2=s2+count+s1.charAt(i);
                count=1;
            }else {
                s2=s2+s1.charAt(i);

            }
        }
        s2=s2+count;
        System.out.println(s2);

    }
}


